package com.zxs.admin.controller;

import com.zxs.admin.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import parm.PageParam;
import pojo.Category;
import utils.R;

/**
 * @author zxs
 * *9 18:24
 */
@RestController
@RequestMapping("category")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    @GetMapping("list")
    public R categoryList(PageParam pageParam) {
        return categoryService.getCategoryList(pageParam);
    }

    @PostMapping("save")
    public R categorySave(Category category) {
        return categoryService.saveCategory(category);
    }

    @PostMapping("remove")
    public R categoryRemove(Category category) {
        return categoryService.removeCategory(category);
    }

    @PostMapping("update")
    public R categoryUpdate(Category category) {
        return categoryService.updateCategory(category);
    }
}
